package org.dtrd.modules.evaluation.entity.bean;

import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.modules.evaluation.constant.Evaluation;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdPsychology;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author QR
 * @Date 2021/11/2 10:16 AM
 */
@ApiModel("心理健康临床症状评估数据")
@Data
public class PsychologyInfo {

    @ApiModelProperty("记录id")
    private Integer id;

    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("输入答案")
    private List<Integer> input;

    private Integer totalScore;

    private String totalLevel;

    private Float somatizationScore;

    private String somatizationLevel;

    private Float obsessionScore;

    private String obsessionLevel;

    private Float relationshipScore;

    private String relationshipLevel;

    private Float depressedScore;

    private String depressedLevel;

    private Float anxiousScore;

    private String anxiousLevel;

    private Float hostileScore;

    private String hostileLevel;

    private Float terrorScore;

    private String terrorLevel;

    private Float paranoiaScore;

    private String paranoiaLevel;

    private Float mentalScore;

    private String mentalLevel;

    private Integer positiveNum;

    private Integer ifPositive;

    @ApiModelProperty("输出内容")
    private String output;

    private Date createTime;

    public PsychologyInfo parseFromPo(DtrdEntEvaluationRdPsychology po) {
        id = po.getDataId();
        patientId = po.getPatientId();
        ArrayList<Integer> answerArr = new ArrayList<>(Evaluation.ProblemNum.PSYCHOLOGY.getNum());
        String answerStr = po.getInput();
        if (StrUtil.isNotBlank(answerStr)){
            String[] strings = answerStr.split(",");
            for (String s : strings) {
                answerArr.add(Integer.parseInt(s));
            }
        }
        input = answerArr;
        totalScore = po.getTotalScore();
        totalLevel = po.getTotalLevel();
        somatizationLevel = po.getSomatizationLevel();
        somatizationScore = po.getSomatizationScore();
        obsessionLevel = po.getObsessionLevel();
        obsessionScore = po.getObsessionScore();
        relationshipLevel = po.getRelationshipLevel();
        relationshipScore = po.getRelationshipScore();
        depressedLevel = po.getDepressedLevel();
        depressedScore = po.getDepressedScore();
        anxiousLevel = po.getAnxiousLevel();
        anxiousScore = po.getAnxiousScore();
        hostileLevel = po.getHostileLevel();
        hostileScore = po.getHostileScore();
        terrorLevel = po.getTerrorLevel();
        terrorScore = po.getTerrorScore();
        paranoiaLevel = po.getParanoiaLevel();
        paranoiaScore = po.getParanoiaScore();
        mentalLevel = po.getMentalLevel();
        mentalScore = po.getMentalScore();
        positiveNum = po.getPositiveNum();
        ifPositive = po.getIfPositive();
        output = po.getOutput();
        createTime = po.getCreateTime();
        return this;
    }
}
